package org.shj.basic

object SuanziDemo {
  def main(args: Array[String]): Unit = {
    println("(1 to 5).reduceLeft(_ - _): " + (1 to 5).reduceLeft(_ - _))
    
    println("(1 to 5).foldLeft(10)(_ - _): " + (1 to 5).foldLeft(10)(_ - _))
    
    val scores = Map("xuruyun" -> 100, "yangmi" -> 90, "zhuyin"-> 80)
    val keys = List("xuruyun", "yangmi","zhuyin")
    println(keys.map(scores(_)))
    
    val map = scores.withDefault(_ * 2)
    println(map.get("xuruyun"))
  }
}